package tech.edwardvan.java.methodreference;

import lombok.extern.slf4j.Slf4j;

import java.util.function.Function;

/**
 * 方法引用
 * <p>
 * 引用特定类型的任意对象的实例方法。例如：Class::method
 *
 * @author EdwardVan
 */
@Slf4j
public class MethodReferenceDemo5 {

    private static void invoke(Function<String, String> function) {
        String result = function.apply("EdwardVan");
        log.info(result);
    }

    public static void main(String[] args) {
        /*
        class 匿名类 implements Function<String, String> {
            public String apply(String s) {
                return s.toLowerCase();
            }
        }
         */
        invoke(String::toLowerCase);
    }
}
